<?php

/**
 * EmailCampaignUserDetails filter form base class.
 *
 * @package    ecrm
 * @subpackage filter
 * @author     Saul Santiago
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseEmailCampaignUserDetailsFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'email_campaign_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('EmailCampaigns'), 'add_empty' => true)),
      'contant_information_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ContantInformation'), 'add_empty' => true)),
      'member_id'                   => new sfWidgetFormFilterInput(),
      'client_id'                   => new sfWidgetFormFilterInput(),
      'hard_bounce_date'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'hard_bounce_status_code'     => new sfWidgetFormFilterInput(),
      'hard_bounce_smtp_response'   => new sfWidgetFormFilterInput(),
      'hard_bounce_apparently_from' => new sfWidgetFormFilterInput(),
      'soft_bounce_date'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'soft_bounce_status_code'     => new sfWidgetFormFilterInput(),
      'soft_bounce_smtp_response'   => new sfWidgetFormFilterInput(),
      'soft_bounce_apparently_from' => new sfWidgetFormFilterInput(),
      'unsubscribe_date'            => new sfWidgetFormFilterInput(),
      'complaint_name'              => new sfWidgetFormFilterInput(),
      'complaint_date'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_at'                  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'                  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'email_campaign_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('EmailCampaigns'), 'column' => 'id')),
      'contant_information_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ContantInformation'), 'column' => 'id')),
      'member_id'                   => new sfValidatorPass(array('required' => false)),
      'client_id'                   => new sfValidatorPass(array('required' => false)),
      'hard_bounce_date'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'hard_bounce_status_code'     => new sfValidatorPass(array('required' => false)),
      'hard_bounce_smtp_response'   => new sfValidatorPass(array('required' => false)),
      'hard_bounce_apparently_from' => new sfValidatorPass(array('required' => false)),
      'soft_bounce_date'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'soft_bounce_status_code'     => new sfValidatorPass(array('required' => false)),
      'soft_bounce_smtp_response'   => new sfValidatorPass(array('required' => false)),
      'soft_bounce_apparently_from' => new sfValidatorPass(array('required' => false)),
      'unsubscribe_date'            => new sfValidatorPass(array('required' => false)),
      'complaint_name'              => new sfValidatorPass(array('required' => false)),
      'complaint_date'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'created_at'                  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'                  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('email_campaign_user_details_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'EmailCampaignUserDetails';
  }

  public function getFields()
  {
    return array(
      'id'                          => 'Number',
      'email_campaign_id'           => 'ForeignKey',
      'contant_information_id'      => 'ForeignKey',
      'member_id'                   => 'Text',
      'client_id'                   => 'Text',
      'hard_bounce_date'            => 'Date',
      'hard_bounce_status_code'     => 'Text',
      'hard_bounce_smtp_response'   => 'Text',
      'hard_bounce_apparently_from' => 'Text',
      'soft_bounce_date'            => 'Date',
      'soft_bounce_status_code'     => 'Text',
      'soft_bounce_smtp_response'   => 'Text',
      'soft_bounce_apparently_from' => 'Text',
      'unsubscribe_date'            => 'Text',
      'complaint_name'              => 'Text',
      'complaint_date'              => 'Date',
      'created_at'                  => 'Date',
      'updated_at'                  => 'Date',
    );
  }
}
